package edu.scau.divineplace.controller;

import edu.scau.divineplace.config.global.log.WebLog;
import edu.scau.divineplace.entity.query.PageQuery;
import edu.scau.divineplace.entity.vo.message.LikeMessageVO;
import edu.scau.divineplace.entity.vo.message.ReplyMessageVO;
import edu.scau.divineplace.service.MessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: x1aolone
 * @Date: 2020/12/11 15:47
 */
@Slf4j
@RestController
@CrossOrigin
@Api("Message控制器")
@WebLog("Message控制器")
@RequestMapping("/message")
public class MessageController {

    @Autowired
    private MessageService messageService;


    @ApiOperation("通过用户id获取该用户的被回复消息，支持完美分页")
    @GetMapping("/reply/list/{userId}")
    public List<ReplyMessageVO> listReplyMessage(@PathVariable Long userId, PageQuery pageQuery){
        return messageService.listReplyMessage(userId, pageQuery);
    }

    @ApiOperation("通过用户id获取该用户的被点赞消息，支持完美分页")
    @GetMapping("/like/list/{userId}")
    public List<LikeMessageVO> listLikeMessage(@PathVariable Long userId, PageQuery pageQuery){
        return messageService.listLikeMessage(userId, pageQuery);
    }

}
